﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MSBDATAModel;

public partial class Admin_QLTaiKhoanNH : System.Web.UI.Page
{
    MSBDATAEntities entities = new MSBDATAEntities();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GridView1.AutoGenerateColumns = false;

            // create column
            BoundField field = new BoundField();
            field.DataField = "ChuTaiKhoan";
            field.HeaderText = "Chủ tài khoản";
            GridView1.Columns.Add(field);

            field = new BoundField();
            field.DataField = "TenChuTaiKhoan";
            field.HeaderText = "Tên chủ tài khoản";
            GridView1.Columns.Add(field);

            field = new BoundField();
            field.DataField = "SoTaiKhoan";
            field.HeaderText = "Số tài khoản";
            GridView1.Columns.Add(field);

            field = new BoundField();
            field.DataField = "SoTien";
            field.HeaderText = "Số tiền";
            GridView1.Columns.Add(field);

            field = new BoundField();
            field.DataField = "MaTienTe";
            field.HeaderText = "Mã tiền tệ";
            GridView1.Columns.Add(field);

            GridView1.DataSource = from tk in entities.TAI_KHOAN_NGAN_HANG
                                   select new {
                                       ChuTaiKhoan = tk.TAI_KHOAN_WEB.TenDangNhap,
                                       TenChuTaiKhoan = tk.TAI_KHOAN_WEB.Ten,
                                       SoTaiKhoan = tk.SoTaiKhoan,
                                       SoTien = tk.SoTien,
                                       MaTienTe = tk.C_TIEN_TE.MaTienTe
                                   };
            GridView1.DataBind();
        }
    }
}